Introduction

  • Optimal Transport solution in 1D

  • Histogram Equalisation

  • Application to Image contrast enhancement

  • Exercises

Optimal Transport 1D solution

Consider two PDFs \(f\) and \(g\) and their CDFs noted \(F\) (with \(dF(x)=f(x)\ dx\)) and \(G\) (with \(dG(x)=g(x)\ dx\)) respectively, for random variables \(x\) an \(y\).

Problem: How to find a (bijective and differentiable) transformation \(\phi\) such that \(y=\phi(x)\) for two random variables \(x\sim f(x)\) and \(y \sim g(y)\)?

Solution: \[ \phi(x)=G^{-1}\circ F(x) \]

Example Equalization:

In this case \(g\equiv \mathcal{U}\) (uniform) then implying \(G=Id\) (identity function) and so \(G^{-1}=Id\) leading to the solution \[\phi(x)=F(x)\]

Application to Histogram Equalization

Consider the following gray level image of boats. We note this image \(I\) and its pixel intensity values \(x\).

Application to Histogram Equalization

Using all pixel values in \(I\) an histogram can be computed as an approximation of its probability density function noted \(f(x)\)

\[ f(x) \simeq \frac{Histo(x)}{\# pixels} \] Note that pixel values \(x\) have been rescaled from \([0,1]\) from \([0,255]\) in this example.

Application to Histogram Equalization

The Cumulative Distribution Function \(F(x)=\int_{-\infty}^x f(t) \ dt\) can be computed.

Application to Histogram Equalization

Each pixel intensity value \(x\) is changed to \(\tilde{x}=\phi(x)\) using the CDF \(F\) with \[ \phi(x)=Id^{-1}\circ F(x) = F(x) \] (\(G=Id\) is the CDF associated with the Uniform distribution).

Application to Histogram Equalization

The histogram of the transformed image \(\tilde{I}\) is uniform as expected for PDF \(g\equiv\mathcal{U}\) that we have chosen when using mapping solution \(\phi(x)=F(x)\) !

Exercises

  1. Draw the uniform probability density function (PDF) \(g\) on the range of pixel intensity value [0;255].

  2. Draw the CDF \(G\) associated with PDF \(g\) defined previously.

  3. Consider the Logistic function \(F(x)=\frac{1}{1+\exp(-x)}\): is that a possible CDF for a r.v. \(x\in \mathbb{R}\)?

  4. What is the derivative \(f\) of \(F\) defined above? Is that a PDF?

  5. Suggest how histogram equalization could be applied to colour images? Explain